<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOperateLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('operate_logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('username')->default('');
            $table->integer('user_id')->default('0');
            $table->mediumText('content');
            $table->bigInteger('operable_id');
            $table->string('operable_type')->default('');
            $table->timestamps();
            $table->softDeletes();
            $table->index(['operable_id', 'operable_type'], 'operable_index');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('operate_logs');
    }
}
